import fly from './http'



const Api = {
    // 获取用户openId
    getOpenid (code) {
        return fly.post('/login/index', {
            code
        }).then(res => res)
    },
    // 接收头像和昵称并入库
    //  obj = > openid,avatarUrl,nickName
    sendUserInfo (obj) {
        return fly.post('/Authorize/set_nickname_avatar', obj).then(res => res)
    },
    // 获取手机号码
    //  obj = > encryptedData,iv
    getPhone (obj) {
        return fly.post('/Authorize/set_mobile', obj).then(res => res)
    },
    /**
     * 更新session_key
     * @param {unionId,code} obj 
     * @returns 
     */
    updateSession (obj) {
        return fly.post('/Authorize/update_session', obj).then(res => res)
    },

}

export default Api